﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Program21
{
    public class Program
    {
        public delegate string DelProStr(string str);

        private static void Main(string[] args)
        {
            string[] names = { "abcdDE", "DEdfsEFDd", "ASFdf" };
            //三个需求：
            //将所有元素转换成大写
            //将所有元素转换成小写
            //将所有元素两边加上一个双引号
            //用委托来实现
            ProString(names, (name) => { return name.ToUpper(); });//转大写
            ProString(names, (name) => { return name.ToLower(); });//转小写
            ProString(names, (name) => { return "\"" + name + "\""; });//双引号


            foreach (string item in names)
            {
                Console.WriteLine(item);
            }
            Console.ReadKey();

        }

        private static void ProString(string[] names, DelProStr del)
        {
            for (var i = 0; i < names.Length; i++)
            {
                //传入一个处理方式
                names[i] = del(names[i]);
            }
        }
    }
}
